<?php

// Application root path
define('ROOT', getcwd().DIRECTORY_SEPARATOR);
// Includes path
define('INCLUDES', ROOT.'includes'.DIRECTORY_SEPARATOR);
// Current enviroment 
define('STATUS', 'development');

switch(STATUS)  {
	case 'development': {
		error_reporting(E_ALL);
		ini_set('display_errors', '1');
	}
}

if (!isset($_GLOBAL['no-config'])) {
	require('configuration.php');
}

require_once('includes/functions.php');
require_once('includes/classes.php');
require_once('includes/config.php');
require_once('includes/user.php');

$config_table = CONFIG_TABLE;
$pages_table = PAGES_TABLE;
$authors_table = AUTHORS_TABLE;

if (!isset($_GLOBAL['no-db-con'])) {
	try {
		$db = new DB(DB_HOST, DB_USER, DB_PASS, DB_NAME);
	} catch (Exception $e) {
		header('location: ' . error_uri($e->getMessage()));
	}
}

if (!isset($_GLOBAL['no-session'])) {
	$session = new Session();
}

?>